package cn.wizzer.app.user.modules.models;

import cn.wizzer.framework.base.model.BaseModel;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 用户签到
 */
@Data
@Table("user_sign")
public class UserSign extends BaseModel implements Serializable {

    @Column
    @Name
    @Comment("ID")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    @PrevInsert(els = {@EL("uuid()")})
    private String id;

    @Column
    @Comment("编号")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String no;

    @Column
    @Comment("用户ID")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String userId;

    /**
     * 兑换是100 Ball Coin = 1USD
     */
    @Column
    @Comment("数量")
    @ColDefine(type = ColType.FLOAT, width = 16, precision = 6)
    @Default("0")
    private BigDecimal amount;

    /**
     * 兑换是100 Ball Coin = 1USD
     */
    @Column
    @Comment("可用")
    @ColDefine(type = ColType.FLOAT, width = 16, precision = 6)
    private BigDecimal balance = BigDecimal.ZERO;

    @Comment("红包类型 Sign 签到 Exchange 兑换")
    @Column
    @ColDefine(type = ColType.VARCHAR, width = 16, notNull = true)
    private String type;

    @Column
    @Comment("创建时间")
    @PrevInsert(els = @EL("$me.now()"))
    private Long ctAt;


}
